<?php

namespace app\admin\controller;

use app\common\controller\Backend;

/**
 * 获取代理IP日志记录
 *
 * @icon fa fa-circle-o
 */
class DataOverview2 extends Backend
{

    public function import()
    {
        parent::import();
    }

    /**
     * 查看
     */
    public function index()
    {
        return $this->view->fetch();
    }

    // Reap任务用户统计查询
    public function usermange(){
        if ($_GET) {
            $start = $_GET['start'];
            $end = $_GET['end'];
            // dump($start);dump($end);die;
            $upicker= $this->curl_get('http://task.phckz.730893.com/admin/usermange?upicker[]='.urlencode($start).'&upicker[]='.urlencode($end));
            $upicker=json_decode($upicker,true);
            $upickers = $upicker['data']['data'];
            return json($upickers);
        }else{
            $upicker= $this->curl_get('http://task.phckz.730893.com/admin/usermange');
            $upicker=json_decode($upicker,true);
            $upickers = $upicker['data']['data'];
            return json($upickers);
        }
    }


    public static function curl_get($url){
       $testurl = $url;
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, $testurl);
        //参数为1表示传输数据，为0表示直接输出显示。
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        //参数为0表示不带头文件，为1表示带头文件
       curl_setopt($ch, CURLOPT_HEADER,0);
       $output = curl_exec($ch);
       curl_close($ch);
       return $output;
    }

}
